//
//  CommentScoreView.m
//  YJRenter
//
//  Created by 文彬 on 2018/7/12.
//  Copyright © 2018年 文彬. All rights reserved.
//

#import "CommentScoreView.h"
#import "MakeScoreView.h"

@interface CommentScoreView()

@property (strong, nonatomic) UIButton *messBtn;
@property (strong, nonatomic) MakeScoreView *healthScoreView;
@property (strong, nonatomic) MakeScoreView *serviceScoreView;
@property (strong, nonatomic) MakeScoreView *landlordScoreView;
@property (strong, nonatomic) MakeScoreView *facilityScoreView;

@end

@implementation CommentScoreView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (id)init{
    self = [super init];
    if (self) {
        
        [self initControl];
    }
    return self;
}

- (void)initControl{
    [self addSubview:self.messBtn];
    [self addSubview:self.healthScoreView];
    [self addSubview:self.serviceScoreView];
    [self addSubview:self.landlordScoreView];
    [self addSubview:self.facilityScoreView];
}

- (void)layoutSubviews{
    [self.messBtn makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@10);
        make.top.equalTo(@10);
        make.height.equalTo(@30);
        make.width.equalTo(@90);
    }];
    
    [self.healthScoreView makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.messBtn.left);
        make.top.equalTo(self.messBtn.bottom).offset(10);
        make.height.equalTo(@30);
        make.width.equalTo(@200);
    }];
    
    [self.serviceScoreView makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.messBtn.left);
        make.top.equalTo(self.healthScoreView.bottom).offset(5);
        make.height.equalTo(@30);
        make.width.equalTo(@200);
    }];
    
    [self.landlordScoreView makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.messBtn.left);
        make.top.equalTo(self.serviceScoreView.bottom).offset(5);
        make.height.equalTo(@30);
        make.width.equalTo(@200);
    }];
    
    [self.facilityScoreView makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.messBtn.left);
        make.top.equalTo(self.landlordScoreView.bottom).offset(5);
        make.height.equalTo(@30);
        make.width.equalTo(@200);
    }];
}
#pragma mark getter

- (UIButton*)messBtn{
    if (_messBtn==nil) {
        _messBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_messBtn setTitle:@"房屋评分" forState:UIControlStateNormal];
        [_messBtn setImage:[UIImage imageNamed:@"shouye2"] forState:UIControlStateNormal];
        _messBtn.imageEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 60);
        _messBtn.titleLabel.font = [UIFont systemFontOfSize:15];
        [_messBtn setTitleColor:kTitleColor forState:UIControlStateNormal];
    }
    return _messBtn;
}

- (MakeScoreView*)healthScoreView{
    if (_healthScoreView==nil) {
        _healthScoreView = [[MakeScoreView alloc]init];
        _healthScoreView.titleLabel.text = @"整洁卫生";
    }
    return _healthScoreView;
}

- (MakeScoreView*)serviceScoreView{
    if (_serviceScoreView==nil) {
        _serviceScoreView = [[MakeScoreView alloc]init];
        _serviceScoreView.titleLabel.text = @"管理服务";
    }
    return _serviceScoreView;
}

- (MakeScoreView*)landlordScoreView{
    if (_landlordScoreView==nil) {
        _landlordScoreView = [[MakeScoreView alloc]init];
        _landlordScoreView.titleLabel.text = @"房东服务";
    }
    return _landlordScoreView;
}

- (MakeScoreView*)facilityScoreView{
    if (_facilityScoreView==nil) {
        _facilityScoreView = [[MakeScoreView alloc]init];
        _facilityScoreView.titleLabel.text = @"设施环境";
    }
    return _facilityScoreView;
}


@end
